home *** CD-ROM | disk | FTP | other *** search
- unit Cciccinf;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
-
- type
- TCCICInfoDlg = class(TForm)
- Panel1: TPanel;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- Panel4: TPanel;
- ListBox2: TListBox;
- Panel2: TPanel;
- Edit1: TEdit;
- Panel3: TPanel;
- Edit2: TEdit;
- Panel5: TPanel;
- Edit3: TEdit;
- Panel8: TPanel;
- Edit4: TEdit;
- Panel9: TPanel;
- Edit5: TEdit;
- Panel6: TPanel;
- Outline1: TOutline;
- Label1: TLabel;
- Label2: TLabel;
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- Button4: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- CCICInfoDlg: TCCICInfoDlg;
-
- implementation
-
- uses CCICCFrm;
-
- function inet_addr( IPAddressName : PChar ) :
- Unsigned_Long_Integer; far; external 'WINSOCK';
- function gethostbyname( TheName : PChar ) :
- PHost_Entry; far; external 'WINSOCK';
-
- {$R *.DFM}
- procedure TCCICInfoDlg.Button1Click(Sender: TObject);
- var TempSocket : TCCSocket; { Used for IP Address info }
- DataBuffer : array[ 0 .. 256 ] of char;
- begin
- case Tag of
- 1 : begin { Get IP Address Mode }
- { Create the dummy socket }
- TempSocket := TCCSocket.Create( Self );
- TempSocket.Parent := Self;
- { Use it to get the info }
- with TempSocket do
- begin
- { Move the IP address into the data buffer }
- StrPCopy( DataBuffer , Edit1.Text );
- { Turn it into a real IP address in binary form }
- Socket_IP_Address.Socket_Address.Full_Internet_Address :=
- inet_addr( DataBuffer );
- { If not found then do remote lookup }
- if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
- begin
- { Call blocking function on IP name }
- Socket_Host_Entry := gethostbyname( DataBuffer );
- { If still no good then error out and exit }
- if Socket_Host_Entry = nil then
- begin
- Edit2.Text := 'Could Not Convert Host Name';
- Edit3.Text := '';
- end
- else
- begin
- { Otherwise get the address }
- Socket_IP_Address.Socket_Address :=
- Socket_Host_Entry^.Host_Address^^;
- Edit2.Text :=
- IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
- IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
- IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
- '.' + IntToStr(
- Socket_IP_Address.Socket_Address.Local_Machine_Byte );
- Edit3.Text :=
- IntToStr( Socket_IP_Address.Socket_Address.
- Full_Internet_Address );
- end;
- end;
- end;
- { Free the dummy socket }
- TempSocket.Free;
- end;
- end;
- end;
-
- { This procedure saves the newly modified list of stuff to its base }
- { This method cancels any changes made from entries in current setup & exits}
- end.
-